<%@ page import="io.github.luyanfei.Quiz" %>



<div class="fieldcontain ${hasErrors(bean: quizInstance, field: 'name', 'error')} required">
	<label for="name">
		<g:message code="quiz.name.label" default="Name" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="name" required="" value="${quizInstance?.name}"/>

</div>

<div class="fieldcontain ${hasErrors(bean: quizInstance, field: 'createdBy', 'error')} ">
	<label for="createdBy">
		<g:message code="quiz.createdBy.label" default="Created By" />
		
	</label>
	<g:select id="createdBy" name="createdBy.id" from="${io.github.luyanfei.User.list()}" optionKey="id" value="${quizInstance?.createdBy?.id}" class="many-to-one" noSelection="['null': '']"/>

</div>

<div class="fieldcontain ${hasErrors(bean: quizInstance, field: 'modifiedBy', 'error')} ">
	<label for="modifiedBy">
		<g:message code="quiz.modifiedBy.label" default="Modified By" />
		
	</label>
	<g:select id="modifiedBy" name="modifiedBy.id" from="${io.github.luyanfei.User.list()}" optionKey="id" value="${quizInstance?.modifiedBy?.id}" class="many-to-one" noSelection="['null': '']"/>

</div>

<div class="fieldcontain ${hasErrors(bean: quizInstance, field: 'questions', 'error')} ">
	<label for="questions">
		<g:message code="quiz.questions.label" default="Questions" />
		
	</label>
	<g:select name="questions" from="${io.github.luyanfei.Question.list()}" multiple="multiple" optionKey="id" size="5" value="${quizInstance?.questions*.id}" class="many-to-many"/>

</div>

<div class="fieldcontain ${hasErrors(bean: quizInstance, field: 'quizAttempts', 'error')} ">
	<label for="quizAttempts">
		<g:message code="quiz.quizAttempts.label" default="Quiz Attempts" />
		
	</label>
	<g:select name="quizAttempts" from="${io.github.luyanfei.QuizAttempt.list()}" multiple="multiple" optionKey="id" size="5" value="${quizInstance?.quizAttempts*.id}" class="many-to-many"/>

</div>

<div class="fieldcontain ${hasErrors(bean: quizInstance, field: 'grade', 'error')} required">
	<label for="grade">
		<g:message code="quiz.grade.label" default="Grade" />
		<span class="required-indicator">*</span>
	</label>
	<g:field name="grade" value="${fieldValue(bean: quizInstance, field: 'grade')}" required=""/>

</div>

<div class="fieldcontain ${hasErrors(bean: quizInstance, field: 'intro', 'error')} required">
	<label for="intro">
		<g:message code="quiz.intro.label" default="Intro" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="intro" required="" value="${quizInstance?.intro}"/>

</div>

<div class="fieldcontain ${hasErrors(bean: quizInstance, field: 'shuffleQuestions', 'error')} ">
	<label for="shuffleQuestions">
		<g:message code="quiz.shuffleQuestions.label" default="Shuffle Questions" />
		
	</label>
	<g:checkBox name="shuffleQuestions" value="${quizInstance?.shuffleQuestions}" />

</div>

<div class="fieldcontain ${hasErrors(bean: quizInstance, field: 'sumGrades', 'error')} required">
	<label for="sumGrades">
		<g:message code="quiz.sumGrades.label" default="Sum Grades" />
		<span class="required-indicator">*</span>
	</label>
	<g:field name="sumGrades" value="${fieldValue(bean: quizInstance, field: 'sumGrades')}" required=""/>

</div>

<div class="fieldcontain ${hasErrors(bean: quizInstance, field: 'timeClose', 'error')} required">
	<label for="timeClose">
		<g:message code="quiz.timeClose.label" default="Time Close" />
		<span class="required-indicator">*</span>
	</label>
	<g:datePicker name="timeClose" precision="day"  value="${quizInstance?.timeClose}"  />

</div>

<div class="fieldcontain ${hasErrors(bean: quizInstance, field: 'timeLimit', 'error')} required">
	<label for="timeLimit">
		<g:message code="quiz.timeLimit.label" default="Time Limit" />
		<span class="required-indicator">*</span>
	</label>
	<g:field name="timeLimit" type="number" value="${quizInstance.timeLimit}" required=""/>

</div>

<div class="fieldcontain ${hasErrors(bean: quizInstance, field: 'timeOpen', 'error')} required">
	<label for="timeOpen">
		<g:message code="quiz.timeOpen.label" default="Time Open" />
		<span class="required-indicator">*</span>
	</label>
	<g:datePicker name="timeOpen" precision="day"  value="${quizInstance?.timeOpen}"  />

</div>

